<template>
  <div class="app-container">
    <div class="app-title">
      <span>工资停发</span>
    </div>
    <el-row :gutter="20">
      <el-col :span="8">
        <el-col style="text-align:left;paddding-top:10px;padding-left:10px;" :span="4">
          <i :class="[treeShow ? 'el-icon-s-fold treeI' : 'el-icon-s-unfold treeI']" @click="toggerTree" />
        </el-col>
        <div class="tap-fillet">
          <el-radio-group v-model="activeName" style="width:700px;height:15px;margin-top:-65px;margin-left: 63px;">
            <el-radio-button label="0" name="isNoSubmit">可停发</el-radio-button>
            <el-radio-button label="1" name="submit">已停发</el-radio-button>

          </el-radio-group>
        </div>
      </el-col>
      <div class="filter-container">
        <el-col style="text-align:right;margin-top:-3px;" :span="16">
          <el-button size="small" class="filter-item" style="margin-left:10px;" type="primary" @click="Query">
            查询
          </el-button>
          <el-button v-if="activeName === '0'" size="small" class="filter-item" style="margin-left:10px;" type="primary"
            @click="isHandleEdit">
            工资停发
          </el-button>
          <el-button v-if="activeName === '1'" size="small" class="filter-item" style="margin-left:10px;" type="primary"
            @click="isHandleAdd">
            工资恢复
          </el-button>

        </el-col>
      </div>
    </el-row>

    <!-- 图片的显示位置样式
    <div>
      <div>
        <div style="margin-left:72px; position:absolute; margin-top:-53px">
          <img style="width:16px; height:16px;" :src="allimgSrc">
        </div>
        <div style="margin-left:160px; position:absolute; margin-top:-53px">
          <img style="width:16px; height:16px;" :src="Processedimg">
        </div>
      </div>
    </div>  -->
    <div class="grid-content bg-purple" />
    <div ref="box" class="box">
      <div class="left" :class="[isActive ? 'wid' : 'wids']">
        <div :class="[treeShow ? 'treeShow' : 'treeNotShow']" :style="{ 'height': treeHeight + 'px' }">
          <AgencyTree class="agencyTree" @handleTreeQuery="handleTreeQuery"
            @getFirstAuthAgencyData="getFirstAuthAgencyData" />
        </div>
      </div>
      <div v-show="Show" class="resize" title="收缩侧边栏" />
      <div class="mid" :class="[isActive ? 'mids' : 'min']">
        <stopPaySalaryChildrenTable :key="timer" ref="chil" :tree-data="treeData" :tab-pane="activeName" />
      </div>


      <Drag ref="icon" />
    </div>
  </div>

</template>
<script>
import stopPaySalaryChildrenTable from '@/views/unitSalaryReport/children/stopPaySalaryChildren'
import AgencyTree from '@/components/tree/agencyTree'
import Drag from '@/components/Drag'
export default {
  name: 'StopPaySalary',
  components: { stopPaySalaryChildrenTable, Drag, AgencyTree },
  data() {
    return {
      treeShow: false,
      isActive: true,
      treeHeight: null,
      treeData: '',
      Show: false,
      timer: '',
      activeName: '0',
      allimgSrc: require('@/assets/images/select.png'),
      Processedimg: require('@/assets/images/processed.png')

    }
  },
  // 图片显示
  watch: {
    activeName(val) {
      this.timer = new Date().getTime()
      if (val === '0') {
        this.allimgSrc = require('@/assets/images/select.png')
        this.Processedimg = require('@/assets/images/processed.png')
      } else {
        this.allimgSrc = require('@/assets/images/blueselect.png')
        this.Processedimg = require('@/assets/images/blue.png')
      }
    }
  },
  created() { },
  mounted() {
    //this.dragController()
    this.getTeHeight()
  },
  beforeMount() {
    window.addEventListener('resize', this.getTeHeight)
  },
  methods: {
    // 查询
    Query() {
      this.$refs.chil.query()
    },
    //  工资停发
    isHandleEdit() {
      this.$refs.chil.handleEdit()
    },
    // 工资恢复
    isHandleAdd() {
      this.$refs.chil.handleAdd()
    },
    toggerTree() {
      this.treeShow = !this.treeShow
      this.isActive = !this.isActive
      this.Show = !this.Show
    },
    getTeHeight() {
      this.treeHeight = window.innerHeight - 213
      console.log(this.treeHeight)
    },
    getFirstAuthAgencyData(data) {
      this.treeData = data
    },
    handleTreeQuery(data) {
      if (data && data.isleaf === '1') {
        this.treeData = data
      }
    },
  }
}
</script>

<style lang="scss" scoped>
@import "~@/styles/border.scss";

/*引入公共样式*/
.app-title {
  margin-bottom: 15px;
  height: 20px;
  border-bottom: 1px solid #DCDFE6;
}

.agencyTree {
  height: 100%;
  overflow: auto;
}
</style>
